package com.oauth.service.application.global;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;

import com.oauth.service.application.registry.GlobalRegistryService;
import com.oauth.service.application.registry.beans.ApplicationInfoBean;

/**
 * Use this service to do global functionality on the site.
 * 
 * @author asanthan
 * 
 */
public class GlobalServiceImpl implements GlobalService {

	private GlobalRegistryService<ApplicationInfoBean> mGlobalRegistryService;

	public boolean updateStatus(Long pMemberId, Set<Long> pAppIds, String pStatusText) {
		List<ApplicationInfoBean> applicationList = mGlobalRegistryService
				.getApplicationInfo(pAppIds);
		for (ApplicationInfoBean appBean : applicationList) {
			appBean.getAppGlobalService().updateStatus(pMemberId, pStatusText);
		}
		return true;
	}

	@Autowired(required = true)
	public void setGlobalRegistryService(
			GlobalRegistryService<ApplicationInfoBean> pGlobalRegistryService) {
		mGlobalRegistryService = pGlobalRegistryService;
	}

}
